﻿//区域权限分配
/* 对应的方法和ID*/

var fnAreaUserSet = function () {
    var list = this.mDataTable.getRecordSet()._records;
    var elist = [];
    for (var i = 0; i < list.length; i++) {
        //this.getRecordSet()._records[0]._oData["BarItem"]
        if (list[i]._oData["iSun_Selected"] == true) {
            elist.push(list[i]._oData["EmpID"]);
        }
    }
    ids = elist;
    if (ids.length > 0) {
        _fn = GetSelected;
        document.getElementById("EditUIWindow1").src = "../Crm/AreaUserSeting.aspx?empId=" + ids[0]+"";
        YAHOO.example.container.dialog2.show();
    }
    else {
        alert('你没有选中任何项');
    }
}
//取消用户的区域权限设置

var responseSuccess = function (res) {
    try {
        var str = res.responseText;
        if (str == "1") {
            alert('区域权限已取消');
        }
        else {
            alert(str);
        }
    } catch (e) {
    }
    finally {
    }
};
var responseFailure = function (error) {
    alert("数据错误：" + error.statusText);
}
var callback = {
    success: responseSuccess,
    failure: responseFailure
};
//取消用户的权限设置
var fnCancelUserSet = function () {
    var list = this.mDataTable.getRecordSet()._records;
    var elist = [];
    //团长ID
    var managerId;
    for (var i = 0; i < list.length; i++) {
        //this.getRecordSet()._records[0]._oData["BarItem"]
        if (list[i]._oData["iSun_Selected"] == true) {
            elist.push(list[i]._oData["EmpID"]);
            break;
        }
    }
    $("#jsonData").val(elist);
    var formObject = document.getElementById('form2');
    YAHOO.util.Connect.setForm(formObject);
    var url = "../Extend/AjaxData/DataProcessin.aspx?action=cancel&entity=DatEmployee&r=" + Math.random();
    var request = YAHOO.util.Connect.asyncRequest('Post', url, callback);
}


